CSmtpClient Class  
 

Submit email messages for delivery to one or more recipients using SMTP. The class supports delivery through a relay server or directly to a recipient's mail server, with options for authentication and delivery status notification.

Reference

Library Information

Class Name CSmtpClient
File Name CSMTPV12.DLL
Version 12.0.3041.1380
LibID 7EFD241B-CEB0-4667-8944-4231A1B46064
Import Library CSMTPV12.LIB
Dependencies None
Standards RFC 821, RFC 1425, RFC 1869, RFC 2821

Overview

The CSmtpClient class provides methods for submitting outgoing email to one or more recipients. Applications communicate directly with a mail server without requiring a desktop email client or a locally installed mail server. Messages can be submitted through an organization's or service provider's relay server, or sent directly to a recipient's mail server where network access and server policy permit.

High-level submission methods combine connection setup and message submission in a single call. For applications that need more control, session-based methods allow the application to establish a connection, authenticate, specify recipients, and supply message content incrementally. Existing message content can also be appended from a file, allowing the class to work with messages prepared elsewhere in the application.

Asynchronous connection and message submission methods allow applications to coordinate mail delivery with other work. Event callbacks and transfer statistics provide progress information, while task management methods allow applications to inspect completion status and control asynchronous tasks. Configurable timeouts, server result codes, descriptive errors, and optional network tracing help diagnose authentication, connection, and submission failures.

Extended SMTP support provides access to authentication and delivery status notification features advertised by the server. Applications can inspect available extensions and configure delivery options for the session. Secure connections support both implicit TLS and an explicit upgrade using STARTTLS, with client security credentials supplied when needed.

For authentication, the class supports traditional username and password authentication, as well as OAuth 2.0 authentication using the XOAUTH2 and OAUTHBEARER mechanisms. OAuth 2.0 enables applications to authenticate with mail services that require token-based authentication instead of account passwords. Applications are responsible for obtaining and refreshing access tokens using the authentication procedures required by the mail service.

The CMailMessage class complements SMTP by providing detailed control over message formatting, alternative plain text and HTML bodies, attachments, and international character sets. SMTP handles submission of the resulting message. Note that acceptance by a mail server indicates the message has been accepted for delivery, rather than confirming that it has reached or been read by the recipient.

Requirements

The SocketTools Library Edition is compatible with any programming language that can call functions exported from a standard Windows DLL. If you are using Visual Studio, the minimum supported version is Visual Studio 2010 with Service Pack 1 (SP1). The header files are compatible with modern C/C++ compilers, and function declarations are provided for several other languages. We recommend installing the latest updates for your development tools and the Windows SDK.

SocketTools supports Windows 7 SP1, Windows Server 2008 R2 SP1, and later desktop and server versions of Windows, with Windows 8.1 as the minimum supported version for Windows 8-based systems. Both 32-bit and 64-bit Windows platforms are supported for application development. Windows on ARM requires Windows 10 build 1709 or later. We recommend using a version of Windows that is currently supported by Microsoft for application development.

SocketTools provides 32-bit x86, 64-bit x64, and native ARM64 libraries. The x86 libraries maintain compatibility with legacy development tools and can run under emulation on Windows on ARM. Native ARM32 applications are not supported because Microsoft discontinued support for 32-bit ARM applications in Windows.

For native ARM64 development, we recommend Visual Studio 2019 or later. Some development tools, including recent versions of Embarcadero Delphi, support Windows on ARM using the ARM64EC architecture. ARM64EC applications can use x64 DLLs through emulation, but cannot load native ARM64 DLLs. Developers targeting ARM64EC should use the SocketTools x64 libraries rather than the native ARM64 libraries.

Import libraries are provided in COFF format for x86, x64, and ARM64 platforms. OMF libraries are also provided for x86, and ELF libraries for x64, to support older Borland and Embarcadero compilers. Visual Studio developers should use the standard COFF libraries. Some programming languages can call exported DLL functions directly without requiring an import library.

Distribution

When distributing an application that uses this library, we recommend installing the SocketTools DLL in the same folder as the application executable. This simplifies deployment and avoids potential conflicts with other applications that use different versions of the library. The DLL must be compatible with the application's processor architecture (x86, x64, or ARM64). If the library is installed in a shared system location, the installer should manage it as a shared DLL to prevent other applications from being affected when it is updated or removed. SocketTools libraries are standard Windows DLLs, not ActiveX components, and do not require COM registration.

This library has no external runtime dependencies beyond the standard Windows system libraries. It does not require the Microsoft Visual C++ Redistributable or any additional third-party libraries to be installed. All required components are either provided by Windows or statically linked into the SocketTools DLLs, simplifying deployment and eliminating the need to distribute additional runtime files.